<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title></title>
	<link rel="stylesheet" href="http://127.0.0.1/huaweishop/Static/Admin/Bootstrap/Css/bootstrap.min.css" />
	<link rel="stylesheet" href="http://127.0.0.1/huaweishop/Static/Admin/Uploadify/uploadify.css" />
	<link rel="stylesheet" href="http://127.0.0.1/huaweishop/Static/Admin/Css/common.css" />
	<script type="text/javascript" src="http://127.0.0.1/huaweishop/Static/uploadify/jquery-1.8.2.min.js"></script>
	<script type="text/javascript" src="http://127.0.0.1/huaweishop/Static/uploadify/jquery.uploadify.min.js"></script>
	<link href="http://127.0.0.1/huaweishop/Static/uploadify/uploadify.css" type="text/css" rel="stylesheet"></link>
	<style type="text/css">
	    .uploadify-button {
	        background-color: transparent;
	        border: none;
	        padding: 0;
	    }
	    .uploadify:hover .uploadify-button {
	        background-color: transparent;
	    }
	    .img-thumbnail{
	    	
	    }
	    .del-img{
	    	
	    	
	    }
	</style> 
	<script type="text/javascript">
			//让上传按钮显示
			function uploadifyShow(){
        			 $('#logo').uploadify({
                    'formData'     : {//POST数据
                        '<?php echo session_name();?>' : '<?php echo session_id();?>',
                    },
                    'fileTypeDesc' : '上传文件',//上传描述
                    'fileTypeExts' : '*.jpg;*.png',
                    'swf'      : 'http://127.0.0.1/huaweishop/Static/uploadify/uploadify.swf',
                    'uploader' : '<?php echo U("upload");?>',
                    'buttonText':'选择文件',
                    'fileSizeLimit' : '2000KB',
                    'uploadLimit' : 1,//上传文件数
                    'width':65,
                    'height':25,
                    'multi': false,//是否多文件上传
                    'successTimeout':10,//等待服务器响应时间
                    'removeTimeout' : 0.2,//成功显示时间
                    'onUploadSuccess' : function(file, data, response) {
                    	//把变量转为json
                        data=$.parseJSON(data);
                        var li="<li path='"+data.path+"' url='"+data.url+"'><img src='"+data.url+"' class='img-thumbnail'/><a href='javascript:;' class='del-img'>X</a><input type='hidden' name='logo' value='"+data.path+"' /></li>";
	                            $("#uploadList ul").prepend(li);
                    }
                });
	        }
            $(function(){
            
            		//刷新页面让上传插件显示
            		uploadifyShow();
            		//点击x，隐藏图片，并且上传按钮显示
	  			$('.del-img').live('click',function(){	  				
	  				$(this).parent('li').hide();
	  				uploadifyShow();
	  				
	  			})
            });
        </script>
			
</head>
<body>
	<div class="container-fluid">
	<div class="row-fluid">
	<div class="span12">

	<form    action="<?php echo U('Brand/add');?>" method='post'>
		<fieldset>
		<legend>添加商品品牌</legend>
		<table class="table table-bordered table-hover">
			<tr class="info">
				<td>品牌名称</td>
				<td colspan="2">
					<input type="text" name='bname' />
				</td>
			</tr>
			<tr class="info">
				<td>品牌LOGO</td>
				<td>
					<input type="file"  id='logo'  multiple="true"/>
					 <div id="uploadList">
	                <ul>
	                </ul>
	            </div>
					
				</td>
				<td>
					<div id='logo-wrap' style='display:none'></div>
				</td>
			</tr>
			<tr class="info">
				<td>是否热门</td>
				<td colspan="2">
					<input type="checkbox" name='is_hot' value='1'/>
				</td>
			</tr>
			<tr>
				<td colspan='3' align='center'>
					<input type="submit" class="btn btn-primary" value="添加品牌" />
				</td>
			</tr>
		</table>
		</fieldset>
	</form>

	</div>
	</div>
	</div>


</body>
</html>